<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../../inc/conn.asp"-->
<%
'分页-------------------------------------------------------
set Rs=server.CreateObject("ADODB.RecordSet")
sql="select count(sortid) from (Select ROW_NUMBER() OVER (order by id desc) as sortid,* From notice) as TempTable where 1=1"
Pager_Pagesize=5 '每页记录数
Rs.open sql,conn,1,1
Pager_TotalRecord=Rs(0) '总记录数
Rs.close
Pager_PageCount=int((Pager_TotalRecord/Pager_Pagesize)+0.99999) '计算总页数
CurrentPage=Request("page") '当前页
if CurrentPage=0 then CurrentPage=1
'如果不为数字则直接设置页码为1
if isnumeric(CurrentPage)=False Or CurrentPage="" then
	CurrentPage=1
'如果当前页数大于总页数，则直接设置页码为1
elseif  Clng(CurrentPage)>Pager_PageCount then
	CurrentPage=1
end if
Fieldsname=" id,title,content,addtime,sortid"
orderBy=" Order by sortid asc"
'拆分SQL语句，必须是select开头，有唯一标识的列
if instr("select",sql)<>-1 then
	if CurrentPage = 1 then
		sql = replace(sql,"select count(sortid)"," select  top " & Pager_Pagesize  & Fieldsname)
	else  
		sql = replace(sql,"select count(sortid)"," select  top " & Pager_Pagesize   & Fieldsname) & " and sortid >(select max(sortid) from (" & replace(sql,"select count(sortid)"," select  top " & Pager_Pagesize * (CurrentPage - 1)  & Fieldsname) & orderBy & ") AA)"
	end if
end if
sql = sql & orderBy
Rs.open sql,conn,1,1
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>站内公告</title>
<meta name="keywords" content="站内公告" />
<meta name="description" content="站内公告" />
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="/css/style.css" />
<script type="text/javascript" src="/js/jquery.min.js"></script>
</head>
<body>

<!--#include file="../common/top.asp"-->


<!--main-->
<div class="fullwidth bg1">
	<div class="main">
		<div class="clear20"></div>
		<div class="title_4">
			<h2>站内公告</h2><div></div>
		</div>
		<div class="clear20"></div>
		<div class="clear20"></div>		
		
        
        
        
        <%do while not Rs.eof%>
		<div class="notic_box">
			<div class="notic_title">
				<h2><em><%=rs("addtime")%></em><a href="/notice/detail/<%=rs("id")%>"><%=rs("title")%></a></h2>
			</div>
			<ul>
				<li><%=rs("content")%></li>
			</ul>
		</div>
		<div class="clear20"></div>
        <%
		Rs.movenext
		loop
		Rs.close
		Set Rs=nothing
		%>
        
        
        
        
		
		<div class="clear20"></div>
		<div class="page">
        
        <%
		if CurrentPage<=1 then
		pageview="<a><</a>"
		else
		pageview="<a href='/notice?page="&CurrentPage-1&"'><</a>"
		end if
		for tp = -10 to 9
		if Pager_PageCount>=tp+page and tp+page=>1  then 
		if trim(tp+page)=trim(request("page")) then
		pageview=pageview+"<a class='cur_page'>"&tp+page&"</a>"
		else
		pageview=pageview+"<a href='/notice?page="&tp+page&"'>"&tp+page&"</a>"
		end if
		end if
		next
		if Pager_PageCount<CurrentPage+1 then
		pageview=pageview+"<a>></a>"
		else
		pageview=pageview+"<a href='/notice?page="&CurrentPage+1&"'>></a>"
		end if
		response.Write pageview
		%>
        
        
        
        
		</div>
		<div class="clear20"></div>
	</div>
</div>

<div class="clear"></div>

<!--#include file="../common/footer.asp"-->

</body>
</html>